package studentdemo.server;

import studentdemo.dao.TeacherDao;
import studentdemo.dao.TeacherDaoImpl;
import studentdemo.modul.Teacher;
import java.util.List;

public class TeacherService {
    private final TeacherDao teacherDao = new TeacherDaoImpl();

    public boolean addTeacher(Teacher teacher) {
        return teacherDao.insertTeacher(teacher) > 0;
    }

    public boolean updateTeacher(Teacher teacher) {
        return teacherDao.updateTeacher(teacher) > 0;
    }

    public boolean deleteTeacher(String tno) {
        return teacherDao.deleteTeacher(tno) > 0;
    }

    public Teacher getTeacherById(String tno) {
        return teacherDao.getTeacherById(tno);
    }

    public List<Teacher> getTeachersByName(String name) {
        return teacherDao.getTeachersByName(name);
    }

    public List<Teacher> getTeachersByPage(int page, int pageSize) {
        return teacherDao.getAllTeachers(page, pageSize);
    }

    public int getTeacherCount() {
        return teacherDao.getTeacherCount();
    }
} 